﻿using System;

namespace zuoye
{
    class Program
    {
        static void Main(string[] args)
        {
            //第一道
            int xh = 5, yu = 3, xz = 1;
            int io = 3;
            int all = 100;//鸡
            int allmoenkey = 100;//钱
            for (int q =0; q <= allmoenkey;   q++)
            {
                for (int w = 0; w <= allmoenkey; w++)
                {
                    int z = allmoenkey - q - w;
                    if (z % io != 0) continue;
                    z = z / io;
                    int Money = q * xh + w * yu + z * xz;
                    if (Money == allmoenkey)
                    {
                        Console.WriteLine("公鸡的个数：{0},母鸡：{1},小鸡：{2}", q, w, z * io);

                    }
                }
            }
            // 第二道
            int ji = 2;
            int tu = 4;
            int jiao = 94;
            int tou = 35;
            for (int a = 0; a <= 35; a++)
            {
                int b = tou - a;
                int c = a * 2 + b * 4;
                if (jiao == c)
                {
                    Console.WriteLine("鸡：{0}，兔子{1}", a, b);
                }
            }
            //第三题
            int father;
            int mother;
            int bro;
            int di;
            for(father =0;father < 78; father++)
            {
                for (mother=0;mother < 78; mother++)
                {
                    for (bro = 0; bro < 78; bro++)
                    {
                        for (di = 0; di < 78; di++)
                        {
                            if ((father+mother ==78)&&(bro +di ==17)&&(father+4==4*(di +4))&&(mother+4==3*(bro + 4)))
                            {
                                int year = (father - 3 * bro) / 2;
                                Console.WriteLine("公元{0}年", 1998 + year);
                            }
                        }
                    }
                }
            }
            //第四题
            int x;
            int y;
            for (x = 1; x <= 14; x++)
            {
                y = 39 - 2 * x;//做对4道的人
                if (7 + 6 * 5 + 2 * x + 3 * x + 4 * y == 181)
                {
                    Console.WriteLine("做对4道题有{0}人" ,y);
                }
            }
            Console.ReadKey();
        }
    }
}
